<div id="adminpagepanel">
    <h2>Bill Status Management</h2>
    <?php echo validation_errors();?>
    <?php if(!empty($savemessage)){ echo $savemessage;}?>
    <?php echo form_open_multipart('../admin/index.php/module/status/', array('name'=>'frm','id'=>'frm'));?>
    <table class="adminformtable">
        <tr>
            <th colspan="2" style="text-align:left;padding-left:15px">Add Record</th>
        </tr>
        <tr>
            <td valign="top">
                <table cellpadding="0" cellspacing="0" border="0">
                    <tr>
                        <td class="title">Bill Number*</td>
                        <td>
                            <select name="bill_number">
                                <?php foreach($track_list as $tlist){?>
                                <option <?=(isset($editdata['bill_number']) && $editdata['bill_number']==$tlist['bill_number'] ? 'selected="selected"':'');?>  value="<?php echo $tlist['bill_number'];?>"><?php echo $tlist['bill_number'];?></option>
                                <?php }?>
                            </select>
                        </td>
                    </tr> 
                    <tr>
                        <td class="title">Status*</td>
                        <td><input type="text" name="status" value="<?=(isset($editdata['status']) ? $editdata['status'] : '');?>" style="width:250px;" /></td>
                    </tr>
                    <tr>
                        <td class="title">Location*</td>
                        <td><input type="text" name="location" value="<?=(isset($editdata['location']) ? $editdata['location'] : '');?>" style="width:250px;" /></td>
                    </tr>
                    <tr>
                        <td class="title">Date*</td>
                        <td><input type="text" name="sdate" value="<?=(isset($editdata['sdate']) ? $editdata['sdate'] : '');?>" style="width:150px;" placeholder="<?=date('Y-m-d');?>" /> <font style="color:#666666;">Hint: yyyy-mm-dd</font></td>
                    </tr>
                    <tr>
                        <td class="title">Time*</td>
                        <td>
                            <select name="t_hour">
								<option  value="00">00</option>
								<?php for($i=1;$i<25;$i++){?>
								<option <?=(isset($editdata['t_hour']) && $editdata['t_hour']==$i ? 'selected="selected"':'');?>><?=$i?></option>
								<?php }?>                                
                            </select>
							                            
                            <select name="t_min">
                                <option value="00">00</option>
                                <?php for($i=1;$i<61;$i++){?>
								<option <?=(isset($editdata['t_min']) && $editdata['t_min']==$i ? 'selected="selected"':'');?>><?=$i?></option>
								<?php }?>
                            </select>
                        </td>
                    </tr>                                       
                </table>
            </td>
            <td valign="top">                
            </td>
        </tr>
       <tr align="right">
            <td colspan="2" style="text-align:right;"><input type="submit" name="btnSubmit" id="btnSubmit" class="panellinks" value="Save" /> </td>
       </tr>
    </table>
    <input type="hidden" name="editid" value="<?=(isset($editdata['id']) ? $editdata['id'] : '');?>" />
    </form>    
    <table width="" class="adminlistingtable" style="width: 100%;">
        <thead>
        <tr>
            <th>ID</th>
            <th>Bill Number</th>
            <th>Last Status</th>
            <th>Last Report On</th>
            <!--<th>Delivered</th>-->
            <th>Action</th>            
        </tr>
    </thead>
    <?php
    if(isset($status_list) && !empty($status_list)){
        $publish_img =  base_url()."adminimages/publish.png";
        $unpublish_img =  base_url()."adminimages/unpublish.png";
    ?>
        <tbody>
    <?php 
	$i=1;
	foreach($status_list as $tlist){?>
    <tr>
        <td><?=$i;?></td>
        <td><?=$tlist['bill_number']?></td>
        <td><?=$tlist['status']?></td>
        <td><?=$tlist['sdate']." at ".$tlist['t_hour'].":".$tlist['t_min'];?></td>
        <!--<td style="text-align: center;"><a class="listinglink"><?=($tlist['status']==1 ? 'Published':'Unpublish');?></a></td>-->
        <td><a class="listinglink" href="<?php echo base_url('');?>admin/index.php/module/status/<?=$tlist['id']; ?>">Edit</a></td>
    </tr>
    <?php $i++; }?>
    </tbody>
    <?php
    }else{?>
    <tr>
        <td colspan="4"><strong>No bill saved yet</strong></td>
    </tr>
    <?php }?>
    </table>
</div>
<script>
function del(){
    return confirm('Are you sure you want to delete this?');
}
</script>
